/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entitys;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author Administrator
 */
@Entity
@Table(name = "ideas")
@NamedQueries({
    @NamedQuery(name = "Ideas.findAll", query = "SELECT i FROM Ideas i"),
    @NamedQuery(name = "Ideas.findByIId", query = "SELECT i FROM Ideas i WHERE i.iId = :iId"),
    @NamedQuery(name = "Ideas.findBySubject", query = "SELECT i FROM Ideas i WHERE i.subject = :subject")})
public class Ideas implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "i_id")
    private Integer iId;
    @Column(name = "subject")
    private Integer subject;
    @Lob
    @Size(max = 65535)
    @Column(name = "desc")
    private String desc;
    @JoinColumn(name = "usersid", referencedColumnName = "id")
    @ManyToOne
    private Users usersid;

    public Ideas() {
    }

    public Ideas(Integer iId) {
        this.iId = iId;
    }

    public Integer getIId() {
        return iId;
    }

    public void setIId(Integer iId) {
        this.iId = iId;
    }

    public Integer getSubject() {
        return subject;
    }

    public void setSubject(Integer subject) {
        this.subject = subject;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public Users getUsersid() {
        return usersid;
    }

    public void setUsersid(Users usersid) {
        this.usersid = usersid;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (iId != null ? iId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Ideas)) {
            return false;
        }
        Ideas other = (Ideas) object;
        if ((this.iId == null && other.iId != null) || (this.iId != null && !this.iId.equals(other.iId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entitys.Ideas[ iId=" + iId + " ]";
    }
    
}
